import time
from appium import webdriver
from appium.webdriver.common.mobileby import MobileBy
from appium.webdriver.common.touch_action import TouchAction
dict_caps = {
  "deviceName": "x1q",
  "platformName": "Android",
  "platformVersion": "7.1.2",
  "appPackage": "com.lingyue.zebraloan",
  "appActivity": "com.lingyue.banana.activities.BananaLaunchActivity"
}
# 初始化驱动
driver = webdriver.Remote('http://localhost:4723/wd/hub',dict_caps)
# 设置隐式等待
driver.implicitly_wait(15)
# 点击同意按钮：com.lingyue.zebraloan:id/tv_confirm
driver.find_element(MobileBy.ID,"com.lingyue.zebraloan:id/tv_confirm").click()
# 强制等待页面加载
time.sleep(7)
# 点击用户故事：android.widget.ImageView  5
driver.find_elements(MobileBy.CLASS_NAME,"android.widget.ImageView")[5].click()
# 等待页面加载
time.sleep(3)
"""
开始的位置：x=535、y=1564
结束的位置：x=541，y=363
"""
TouchAction(driver).press(x=535,y=1564).move_to(x=541,y=363).release().perform()
"""
TouchAction：滑动的类，需要传入driver驱动
press：从哪里开始滑动；x值和y值
move_to：移动到哪里去
release：松开手指
perform：执行这一组动作
"""

time.sleep(5)